package IO流.转换流;

import java.io.ByteArrayOutputStream;

public class ByteArrayOutPut1 {
    public static void main(String[] args) {
        ByteArrayOutputStream baos=null;
        try {
            StringBuilder sb=new StringBuilder();
            baos=new ByteArrayOutputStream();
            baos.write('a');
            baos.write('b');
            byte[] arr=baos.toByteArray();
            for (int i = 0; i < arr.length; i++) {
                sb.append((char)arr[i]);
            }
System.out.println(sb);
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            try {
                if(baos!=null)baos.close();

            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}
